package day05;

import java.util.Arrays;
import java.util.Random;

public class DayHomeWork05 {
    public static void main(String[] args) {
        System.out.println("~~~~~~~~~~~~~1~~~~~~~~~~~~~~~");
        for (int i = 1; i <= 9; ++i) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j+"*"+i+"="+i*j+"\t");
            }
            System.out.println();
        }
        System.out.println("~~~~~~~~~~~~~2~~~~~~~~~~~~~~~");
        int[] arr1 = new int[10];
        double[] arr2 = new double[10];
        boolean[] arr3 = new boolean[10];
        int[] arr = {1, 2, 3, 4, 5};
        int[] a ;
        System.out.println(arr[0]);
        for (int j : arr) {
            System.out.print(j+"\t");
        }
        System.out.println();
        System.arraycopy(arr,0,arr1,1,5);
        System.out.println(Arrays.toString(arr1));
        a = Arrays.copyOf(arr, 10);
        System.out.println(Arrays.toString(a));

        System.out.println("~~~~~~~~~~~~~3~~~~~~~~~~~~~~~");
        Random rand = new Random();
        int[] c =new int[10];
        for (int i = 0; i < c.length; ++i) {
            c[i] = rand.nextInt(100);
        }
        Arrays.sort(c);
        System.out.println(Arrays.toString(c));
        c=Arrays.copyOf(c, c.length + 1);
        c[c.length - 1] = c[c.length - 2];
        System.out.println(Arrays.toString(c));
        System.out.println("~~~~~~~~~~~~~4~~~~~~~~~~~~~~~");
        int[] d = new int[10];
        for (int i = 0; i < d.length; ++i) {
            d[i] = rand.nextInt(100);
        }
        System.out.println(Arrays.toString(d));
        Arrays.sort(d);
        System.out.println(Arrays.toString(d));
    }
}
